home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / SOURCE.BIN / RecordNumberLabel.java < prev    next >
Encoding:
Java Source  |  1997-06-19  |  1.6 KB  |  71 lines

  1. /*
  2.  *
  3.  * 2     12/20/96 2:18a Tjones
  4.  * Changed empty constructor for jblender
  5.  *
  6.  * 1     11/25/96 10:48a Cthrons
  7. */
  8.  
  9. package symantec.itools.db.awt;
  10.  
  11. // import java.awt.*;
  12. import java.util.*;
  13. import symjava.sql.*;
  14. import java.lang.*;
  15. import symantec.itools.db.net.*;
  16. import symantec.itools.db.pro.*;
  17.  
  18. /**
  19.  * A TextField object is a single-line area that displays text.
  20.  * It can be bound to a projection in a database.
  21.  * It can be set to allow editing or read-only modes.
  22.  *
  23.  */
  24. public class RecordNumberLabel extends java.awt.Label implements RecordLink
  25. {
  26.     /**
  27.      * The ProjBinder object which this component can use to get data from
  28.      * the server, or change data at the database server.
  29.      */
  30.     ProjBinder m_ProjBinder;
  31.  
  32.     /**
  33.      * Constructs a new TextField.
  34.      */
  35.     public RecordNumberLabel()
  36.     {
  37.         super("<Record Number Label>");
  38.     }
  39.  
  40.     /**
  41.      * Called when the object is bound to a RelationView
  42.      *
  43.      */
  44.     public void init ()
  45.     {
  46.         setText("Invalid");
  47.     }
  48.  
  49.     /**
  50.      * Called when the current Record in a Relationview is changed.
  51.      */
  52.     public void notifyRecordChange (Record currentRecord)throws SQLException
  53.     {
  54.         if (currentRecord != null && currentRecord.getRelationView() != null)
  55.         {
  56.             setText(currentRecord.getRelationView().getCurrentRecordNumberString());
  57.         }
  58.     }
  59.  
  60.     public void setRelationView (RelationView rv)
  61.     {
  62.         try
  63.         {
  64.             rv.bindCurrentRecord(this);
  65.         }
  66.         catch (SQLException ex)
  67.         {
  68.             System.out.println(ex.getMessage());
  69.         }
  70.     }
  71. }